﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Apilication.Common.Breeding;
using Traceability.App.Apilication.Common.Slaughter;
using Traceability.App.Domain;
using Traceability.Domain;
using Traceability.ErrorCode;

namespace Traceability.App.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BreedingController : ControllerBase
    {
        private readonly IMediator mediator;

        public BreedingController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 养殖信息添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> BreedingHandle(CreateBreedingCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 根据生产批次查询养殖信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<BreedingModel>>> InquireBreedingHandle([FromQuery]InquireBreedingCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 修改养殖信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<ApiResult<int>> UpdateBreedingHandle(UpdateBreedingCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖企业的新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> CreateBreedingHandle(CreateBreedingEnterCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 根据生产批次反填养殖企业的信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<BreedingEnterprises>>> GetBreedingEnterHandle([FromQuery]GetBreedingEnterCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖企业的修改方法
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<ApiResult<int>> UpdateBreedingEnterHandle(UpdateBreedingEnterCommon request)
        {
            return mediator.Send(request);
        }

        }
}
